package suzf.top.kotlinjava.common.config

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize
import org.mybatis.spring.annotation.MapperScan
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration


/**
 *
 *========================
 * Created with IntelliJ IDEA
 * Author:Mr.Su
 * Blog: https://suzf.top/
 * Date:2019/10/15
 * ========================
 */
@Configuration
@MapperScan(value = "suzf.top.kotlinjava.common.mapper")
class MybatisPlusConfig {

    @Bean
    fun performanceInterceptor(): PaginationInterceptor {
        // 开启 count 的 join 优化,只针对 left join !!!
        return PaginationInterceptor().setCountSqlParser(JsqlParserCountOptimize(true))
    }
}
